<!DOCTYPE html>
<html lang="en" ng-app="SignUp" ng-controller="SignUpController">
<head>
  <meta charset="UTF-8">
  <title>一个Angular验证</title>
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <style>
    .wapper{
      width: 300px;
      margin: 0 auto;
    }
    .erro{
      color: rgb(226, 119, 32);
    }
  </style>
</head>
<body>
  <section class="container">
    <form method="get" ng-submit="submitForm()" name="signUpForm">
      <article class="wapper">
        <h2>Form SignUp</h2>
        <div class="form-group" ng-class="{'has-success':signUpForm.username.$valid}">
          <label for="username">用户名</label>
          <input type="text"
          name="username"
          id="username"
          maxlength="8"
          ng-minlength="4"
          ng-model="userData.username"
          required
          class="form-control">
          <small class="erro" ng-if="signUpForm.username.$error.required && signUpForm.username.$touched">用户名不能为空</small>
          <small class="erro" ng-if="signUpForm.username.$error.minlength && signUpForm.username.$touched">用户名应在4-8位之间</small>
        </div>
        <div class="form-group" ng-class="{'has-success':signUpForm.password.$valid}">
          <label for="password">密码</label>
          <input type="password"
          name="password"
          id="password"
          maxlength="32"
          ng-minlength="4"
          ng-model="userData.password"
          required
          class="form-control">
          <small class="erro" ng-if="signUpForm.password.$error.required && signUpForm.password.$touched">密码不能为空</small>
          <small class="erro" ng-if="signUpForm.password.$error.minlength && signUpForm.password.$touched">密码长度应在6-32位之间</small>
        </div>
        <div class="form-group" ng-class="{'has-success':signUpForm.password2.$valid}">
          <label for="password2">确认密码</label>
          <input type="password"
          name="password2"
          id="password2"
          ng-model="userData.password2"
          compare="userData.password"
          required
          class="form-control">
          <small class="erro" ng-if="signUpForm.password2.$error.compare && signUpForm.password.$touched">两次输入的不一致</small>
        </div>

        <ul>
          {{ userData.password | pttener}}
          <h3>筛选结果 <small>当前时间 {{ 1432075948123 | date:"yyyy-MM-dd"}}</small></h3>
          <li ng-repeat="u in mvall | filter: 4">{{$index + '---'}}{{ u | currency:'￥'}}</li>
          <br>
          <li ng-repeat="d in testobj"><input type="text" name="name[{{$index}}][name]" ng-model="testobj[$index].user"></li>
        </ul>

        <div class="form-group">
          <button class="btn btn-info btn-block" ng-disabled="signUpForm.$invalid">注册</button>
        </div>
      </article>
    </form>
  </section>

  <section>
    <button class="btn btn-default" id="test1">测试$apply</button>{{test1}}
  </section>


<script src="js/angular.min.js"></script>
<script src="js/jquery.js"></script>
<script src="js/main.js"></script>
</body>
</html>
